//
//  TaskOrderTableViewCell.m
//  BaishidaiKnight
//
//  Created by mac book on 2019/1/28.
//  Copyright © 2019年 sy. All rights reserved.
//

#import "TaskOrderTableViewCell.h"

@interface TaskOrderTableViewCell ()


@property(nonatomic,strong) UILabel* orderNumLabel;
@property(nonatomic,strong) UILabel* orderTimeLabel;
@property(nonatomic,strong) UILabel* orderStatusLabel;

@end


@implementation TaskOrderTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        [self createSubviews];
        
    }
    return self;
}

#pragma mark - createSubviews
-(void)createSubviews{
    
    
    
    [self.contentView addSubview:self.orderNumLabel];
    [self.contentView addSubview:self.orderTimeLabel];
    [self.contentView addSubview:self.orderStatusLabel];
    
    
    [self.orderNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(10);
        make.right.equalTo(self.contentView);
        make.height.mas_equalTo(30);
        
    }];
    
    [self.orderTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.orderNumLabel.mas_bottom);
        make.left.right.height.equalTo(self.orderNumLabel);
        
    }];
    
    [self.orderStatusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.orderTimeLabel.mas_bottom);
        make.left.right.height.equalTo(self.orderTimeLabel);
        
    }];
    
    
    
   
    
    
    
    
}


-(void)setTaskModel:(TaskModel *)taskModel{
    
    _taskModel = taskModel;
    
    TaskModel *twoModel = taskModel.items.firstObject;

    self.orderNumLabel.text = [NSString stringWithFormat:@"订单编号：%@",taskModel.main_id];
    self.orderTimeLabel.text = [NSString stringWithFormat:@"下单时间：%@",twoModel.add_time];
    
    NSString *type;
    if ([twoModel.paytype isEqualToString:@"2"]) {
        type = @"微信支付";
    }else
    {
        type = @"其他支付";
    }
    
    self.orderStatusLabel.text = [NSString stringWithFormat:@"交易状态：已使用%@",type];
    
}


-(UILabel *)orderNumLabel{
    if(!_orderNumLabel){
        _orderNumLabel = [[UILabel alloc]init];
        _orderNumLabel.textColor =kMyColor(130, 130, 130);
        _orderNumLabel.font = kFontNameSize(14);
    }
    return _orderNumLabel;
}


-(UILabel *)orderTimeLabel{
    if(!_orderTimeLabel){
        _orderTimeLabel = [[UILabel alloc]init];
        _orderTimeLabel.textColor =kMyColor(130, 130, 130);
        _orderTimeLabel.font = kFontNameSize(14);
    }
    return _orderTimeLabel;
}


-(UILabel *)orderStatusLabel{
    if(!_orderStatusLabel){
        _orderStatusLabel = [[UILabel alloc]init];
        _orderStatusLabel.textColor =kMyColor(130, 130, 130);
        _orderStatusLabel.font = kFontNameSize(14);
    }
    return _orderStatusLabel;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
